OPC Studio User's Guide and Reference
OPC Data Client Python Examples
Examples > Examples in the Product and on the Web > OPC Data Client Python Examples
In This Topic

The examples are targeting Microsoft .NET Framework 4.7.2 (and will also run under newer versions), and/or .NET 6 or 8.

Python examples were originally tested in CPython 3.6.2 with pythonnet 2.5.2, and CPython 3.11.5 with pythonnet 3.0.2.

On Windows, if you have used the Setup Program to install OPC Data Client, Python projects and Visual Studio solutions with examples in Python are available from the Start menu or the Launcher application. On other platforms (or when you are simply installing the OPC Data Client Python Packages), you are advised to download the example archives from the Web and unpack them on your computer. This is described further below.

Examples on GitHub

Example Archive Files

Examples for Python can be downloaded directly from the Web, in form of archive (.TGZ or .ZIP) files. This distribution method can be used without running any installer, on all operating systems. The archive files available are:

The examples are delivered in source form only. If you want to run them, you need to have or install the proper .NET runtime. For .NET 6 or 8:

Retrieving the Example Archives

In order to use the example archives, first download them to your system, and extract the files from the archive. With a GUI on Windows, you can download the files using a Web browser, and uncompress the .ZIP with built-in Windows Explorer (shell) commands. You may have similar features on your Linux, depending on what distribution you chose. If you don't, following commands can be used in the terminal to download and extract the archives (the URL and file names are just examples - replace them with the right ones if you need a different set of examples):

wget "http://cdn.opclabs.com/files/downloads/OPCLabs-OpcStudio/2024.2/Examples-Python.tgz"
tar -xvzf Examples-Python.tgz

On macOS, and on Linux systems where wget is not available, you can use curl -O instead.       

Examples for OPC "Classic" (OPC-DA, OPC XML-DA and OPC-A&E)

Console Examples

DocExamples: A large collection of OPC “Classic” and OPC XML-DA console-based examples that illustrate the use of individual objects in the product, and their members. These are the same examples that appear in reference and conceptual documentation, with an extra control routine that allows the use to choose an example to be performed.

Windows Forms Examples

FormsDocExamples: A collection of OPC “Classic” and OPC XML-DA Windows Forms-based examples that illustrate the use of individual objects in the product, and their members. These are the same examples that appear in reference and conceptual documentation, with an extra control routine that allows the use to choose an example to be performed. 

Examples for OPC Unified Architecture (OPC-UA)

Console Examples

UADocExamples: A large collection of OPC-UA console-based examples that illustrate the use of individual objects in the product, and their members. These are the same examples that appear in reference and conceptual documentation, with an extra control routine that allows the use to choose an example to be performed.

Windows Forms Examples

UAFormsDocExamples: A collection of OPC-UA Windows Forms-based examples that illustrate the use of individual objects in the product, and their members. These are the same examples that appear in reference and conceptual documentation, with an extra control routine that allows the use to choose an example to be performed. 

 

See Also

Fundamentals

Getting Started